package com.aier.admin.action;

import java.io.File;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.aier.school.service.ISchoolService;

@Scope("prototype")
@Component("adminCreateSchoolAction")
public class AdminCreateSchoolAction extends AdminBaseAction {
    /**
     * 批量导入学校信息
     */
    private static final long serialVersionUID = 1L;

    
    @Resource(name="schoolService")
    private ISchoolService schoolService;
    

    // 城市ID
    private Integer cid;
    // 学校ID
    private Integer sid;
    
    private Integer pcid;
    
    private File file;
    private String fileContentType;
    private int s;                //成功:1 ,失败:0
    private String error_info;    //错误提示信息
    
    // 当前页
    private int page;

    // 每页显示记录数

    private int page_size;

    // 总页数

    private int page_count;

    // 总数

    private int count;

    @Override
    public String execute() {

        return SUCCESS;
    }


    /**
     * 上传模板信息(解析生成)
     */
    public String uploadExcelModule() {
        
        try {
            if (file == null) {
                s = 0;
                error_info = "请选择一个导入模板";
                return SUCCESS;
            }
            s = schoolService.insertQuickSchool(file, fileContentType);
        } catch (Exception e) {
            s = 0;
            error_info = e.getLocalizedMessage();
        }
        return SUCCESS;
        
    }


    public int getS() {
        return s;
    }



    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getPage_size() {
        return page_size;
    }

    public int getPage_count() {
        return page_count;
    }

    public int getCount() {
        return count;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public String getFileContentType() {
        return fileContentType;
    }

    public void setFileContentType(String fileContentType) {
        this.fileContentType = fileContentType;
    }



    public void setCid(Integer cid) {
        this.cid = cid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public Integer getPcid() {
        return pcid;
    }


    public void setPcid(Integer pcid) {
        this.pcid = pcid;
    }


    public String getData_url() {
        return data_url;
    }


    public void setSchoolService(ISchoolService schoolService) {
        this.schoolService = schoolService;
    }


    public String getError_info() {
        return error_info;
    }

}